//
//  Left_1_ViewController.m
//  SlideViewTest
//
//  Created by Nancy on 13-7-11.
//  Copyright (c) 2013年 Nancy. All rights reserved.
//

#import "Left_1_ViewController.h"
#import "ViewController.h"
#import "model.h"
@interface Left_1_ViewController ()

@end

@implementation Left_1_ViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.view.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

-(void)leftButtonClickHandler:(id)sender
{
    //[self.viewDeckController toggleLeftViewAnimated:YES];
    
    UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 80, 80)];
    view.backgroundColor=[UIColor redColor];
    view.alpha=1;
    
    //[self.view addSubview:view];
    
    [UIView animateWithDuration:2.0 animations:^{
        view.frame=CGRectMake(100, 200, 80, 80);
        
    } completion:^(BOOL finished) {
        [self.viewDeckController closeLeftViewAnimated:YES duration:1.0
                                            completion:^(IIViewDeckController *controller, BOOL success)
         {
             if (success) {
                 model *mode=[model shareModel];
                 mode.backHome=YES;
                 self.viewDeckController.centerController = [model shareMain];
                 //self.viewDeckController.centerController.view.alpha=0;
                 self.view.userInteractionEnabled = YES;
                 
             }
             
         }];
    }];
    
    
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
	UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [leftBtn setTitle:@"ShowLeftView" forState:UIControlStateNormal];
    [leftBtn.titleLabel setFont:[UIFont systemFontOfSize:14.0]];
    leftBtn.frame = CGRectMake(5.0, (460-30.0-44)/2, 100.0, 30.0);
    [leftBtn addTarget:self action:@selector(leftButtonClickHandler:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:leftBtn];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
